You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds GET /v1-alpha/oss-index/groups (IN-1414, epic IN-1146). It returns the OSS Index category groups with their top collections and top projects.
api/src/lib/oss-index.ts holds the shared pieces for the OSS Index routes: guards and mappers that turn the pipe's positional topCollections and topProjects tuples into named objects, their schemas, and the sort query param.
oss-index/groups.ts reads category_groups_oss_index. type filters the groups and sort (totalContributors or softwareValue, default totalContributors) orders them.
Project tuples map their logo slot to logoUrl, and their v2 health fields to healthScore, healthLabel and healthMaxScore, as the collection projects endpoint does. The pipe's v1 score is left out.
isHealthScore in src/lib/overview.ts holds the v2 health check, now shared with src/lib/collections.ts.
A malformed row or tuple answers 503 upstream_unavailable. An invalid sort answers 400.
Notes
Tuple slots are non-nullable apart from the four v2 health fields that end a project tuple, so any other null counts as a malformed row.
The response is { data: [...] }, matching the leaderboards routes.
The categories and collections endpoints stack on this branch and reuse the shared module.
Tests
tests/oss-index.test.ts: tuple guards and mappers.
tests/oss-index-groups.test.ts: response shape, sort and type forwarding, 400 for an invalid sort, 503 for malformed rows, empty list, and the OpenAPI entry.
Low Risk
Read-only new endpoint with strict upstream validation; shared health validation refactor is covered by existing and new tests.
Overview
Adds GET /v1-alpha/oss-index/groups, which returns OSS Index category groups (totals, leading collections, leading projects) from the category_groups_oss_index Tinybird pipe. Optional type filters group kind; sort (totalContributors or softwareValue) is passed through as orderBy. Malformed pipe rows answer 503; invalid sort answers 400.
Introduces api/src/lib/oss-index.ts for pipe tuple validation, OpenAPI schemas, and mappers that turn positional topCollections / topProjects tuples into named objects (including v2 healthScore, healthLabel, healthMaxScore on projects, dropping the v1 score).
isHealthScore moves into overview.ts and replaces duplicated health-field checks in collections.ts, with added tests for inconsistent health triples and repo rows that have a score but no maximum.
Reviewed by Cursor Bugbot for commit 0f77152. Bugbot is set up for automated code reviews on this repo. Configure here.
The generated OpenAPI schema does not encode the stated 0–1 constraint, although bounded numeric responses elsewhere use minimum/maximum (for example collections/metrics.ts:37-43). Add the bounds so generated clients and validators receive the actual contract.
This issue also appears on line 84 of the same file.
Expose average bounds in the public OpenAPI schema
The public schema states that this average is 0–1 but does not expose those bounds in OpenAPI. Add the same minimum/maximum constraints used by other bounded score responses such as collections/metrics.ts:37-43.
This accepts off-contract tuples longer than the 13-slot TopProjectTuple and silently ignores their tail, so malformed upstream data can return 200 instead of the promised 503. Require the exact tuple length.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
GET /v1-alpha/oss-index/groups(IN-1414, epic IN-1146). It returns the OSS Index category groups with their top collections and top projects.api/src/lib/oss-index.tsholds the shared pieces for the OSS Index routes: guards and mappers that turn the pipe's positionaltopCollectionsandtopProjectstuples into named objects, their schemas, and thesortquery param.oss-index/groups.tsreadscategory_groups_oss_index.typefilters the groups andsort(totalContributorsorsoftwareValue, defaulttotalContributors) orders them.logoslot tologoUrl, and their v2 health fields tohealthScore,healthLabelandhealthMaxScore, as the collection projects endpoint does. The pipe's v1 score is left out.isHealthScoreinsrc/lib/overview.tsholds the v2 health check, now shared withsrc/lib/collections.ts.upstream_unavailable. An invalidsortanswers 400.Notes
{ data: [...] }, matching the leaderboards routes.Tests
tests/oss-index.test.ts: tuple guards and mappers.tests/oss-index-groups.test.ts: response shape, sort and type forwarding, 400 for an invalid sort, 503 for malformed rows, empty list, and the OpenAPI entry.main